<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <!-- 1、计算一个数的阶乘位数多少个零

```
示例 1:

输入: 3
输出: 0
解释: 3 * 2 * 1 = 6, 尾数中没有零。
示例 2:

输入: 5
输出: 1
解释: 5 * 4 * 3 * 2 * 1 = 120, 尾数中有 1 个零
 -->
</head>
<body>
  <script>
  var trailingZeroes = function(n) {
    let ans = 0;
    for (let i = 5; i <= n; i += 5) {
        for (let x = i; x % 5 == 0; x /= 5) {
            ++ans;
        }
    }
    return ans;
  };
  console.log(trailingZeroes(5));
  </script>
</body>
</html>